import java.io.File;
import java.util.Iterator;
import java.util.Vector;

public class CorpusFile {
	private String name_;
	private int num_chars_;
	private int num_words_;
	private int num_lines_;
	private Vector corpus_words_;
	
	public CorpusFile(String name){
		name_ = (new File(name)).getAbsolutePath();
		corpus_words_ = new Vector();
		num_chars_ = 0;
		num_words_ = 0;
		num_lines_ = 0;
	}
	
	public void addCorpusWord(CorpusWord cw){
		corpus_words_.add(cw);
	}
	
	public boolean contains(String corpus_word){
		for(Iterator i = corpus_words_.iterator(); i.hasNext();){
			CorpusWord curr_corpus_word = (CorpusWord)i.next();
			if(curr_corpus_word.getWord().equals(corpus_word))
				return true;
		}
		return false;
	}
	
	public CorpusWord getCorpusWord(String corpus_word){
		for(Iterator i = corpus_words_.iterator(); i.hasNext();){
			CorpusWord curr_corpus_word = (CorpusWord)i.next();
			if(curr_corpus_word.getWord().equals(corpus_word)){
				return curr_corpus_word;
			}
		}
		return null;
	}
	
	public void addChar(){
		num_chars_++;
	}
	
	public void subtractChar(){
		num_chars_--;
	}
	
	public void addWord(){
		num_words_++;
	}
	
	public void addLine(){
		num_lines_++;
	}
	
	public Vector getCorpusWords(){
		return corpus_words_;
	}
	public int getNumberOfCharacters() {
		return num_chars_;
	}
	public int getNumberOfLines() {
		return num_lines_;
	}
	public int getNumberOfWords() {
		return num_words_;
	}
	public String getFileName() {
		return name_;
	}
}

